#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:zhuyuping
# datetime:2020/6/20 15:23

from django.http import JsonResponse
from .response_code import ResCode


def translate2json(errno=ResCode.OK, errmsg='', **kwargs):
    json_dict = {'errno': errno, 'errmsg': errmsg}
    if kwargs and isinstance(kwargs, dict) and kwargs.keys():
        json_dict.update(kwargs)
    return JsonResponse(json_dict)
